package com.aix.demo.db;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.aix.demo.entity.Person;

public class PersonDao {
	
	private DBHelper dbHelper;
	
	public PersonDao(Context context) {
		dbHelper = new DBHelper(context);
	}
	
	public void add(Person person) {
		SQLiteDatabase db = dbHelper.getWritableDatabase();
		ContentValues values = new ContentValues();
		values.put("name", person.getName());
		long id = db.insert("t_person", null, values);
		person.setId(id);
		db.close();
	}
	
	public void get(long id) {
		SQLiteDatabase db = dbHelper.getWritableDatabase();
		db.close();
	}
}
